home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / doom / turric03.zip / TURRIC03.ZIP / PROGS / M-TEMPLA.QC < prev    next >
Text File  |  1997-01-30  |  4KB  |  109 lines

  1. /// This is a template for adding a new morph.
  2. ///
  3. /// Complete the fields you want to change from the base player
  4. ///
  5. /// Add appropriate pre-caching for any sounds/models you use in this morph
  6. ///
  7. /// Then add some way (an item, impulse, or anything else) to call
  8. /// player_XXX_become
  9. ///
  10. /// The various fields you can set are:
  11. /// Functions:
  12. ///
  13. /// _stand:  We want to show the standing animation
  14. /// _run:    We want to show the running/moving animation
  15. ///          (You could check if the vlen(self.velocity) is large or small,
  16. ///           and show either a running animation or a walking animation,
  17. ///           since both are present in many monsters)
  18. /// _pain:   We just got hurt.  Maybe show a pain animation, make a sound, ...
  19. /// _jump, _jump2:   Player pressed the jump button.  Checks (in water, on ground)
  20. ///          are _not_ made before _jump is called, but are made before _jump2 is
  21. ///          called.  _jump2 is not called if _jump is not SUB_Null.
  22. /// _attack: time > self.attack_finished and we are pressing fire
  23. ///          show attack animation, fire projectiles, set self.attack_finished
  24. ///          Maybe check self.weapon, which can be set from _impulse
  25. /// _impulse: An impulse command from 1..9 was pressed.  Switch  weapon or do
  26. ///          whatever else is appropriate 
  27. /// _can_get_p: Return true if player can get the item, or false if not.
  28. ///          Note that 'self' is _not_ the player in _can_get_p.
  29. ///          SUB_True and SUB_False can be used here.
  30. ///          Currently, morphed players can _always_ get health
  31. ///          Return 0 for 'not get', return 1 for 'can get'.
  32. ///          In the case of ammo, return '2' for 'get, but don't update weapon'
  33. ///          (I should add SUB_get_powerups/SUB_get_ammo, ...
  34. ///           Or maybe make a bitfield, FL_GET_AMMO, FL_GET_WEAPON, ... ?)
  35. /// _killmsg, _killmsg2: Return the message that should be printed,
  36. ///          similarly to the code in client.qc.  Again, self is not player
  37. ///
  38. /// SUB_Null means to use the default player action,
  39. /// SUB_Nop means that the action does nothing (such as jump for the zombie)
  40. ///
  41. ///
  42. /// Variables:
  43. /// modelindex_morph: setmodel to the new model for player, then
  44. ///          self.modelindex_morph=self.modelindex
  45. /// weaponmode, view_ofs: regular meaning
  46. /// health_modifier: the amount that health should be divided by when
  47. ///          changing to another morph.  Generally, you multiply by this
  48. ///          same number when becoming that morph
  49. ///
  50. /// Call DropBackpack2() if it is inappropriate for the player to carry
  51. /// ammo in his new morph
  52. ///
  53. /// If it's necessary to add a new behaviours, make sure you amend
  54. /// the other player_*_become() to set it back the way it was
  55.  
  56. void() player_template_become = {
  57. //** PATCH_BEGIN - morph2 - Turrican ****
  58. //    bprint(self.netname);
  59. //    bprint(" has become a template.\n");
  60.     sprint( self, "You have become a template.\n");
  61.  
  62. // Stop the morph from flying.
  63.     if (self.flags & FL_FLY)
  64.     {
  65.         localcmd("fly");
  66.         self.flags = self.flags - FL_FLY;
  67.     }
  68.  
  69.     self._die = player_template_die;
  70. //** PATCH_END - morph2 - Turrican ******
  71.     self._stand=player_template_stand;
  72.     self._run=player_template_run;
  73.     self._pain=player_template_pain;
  74.     self._jump=player_template_jump;
  75.     self._jump2=player_template_jump2;
  76.     self._attack=player_template_attack;
  77.     self._impulse=player_template_impulse;
  78.     self._can_get_p=player_template_can_get_p;
  79.     self._killmsg=player_template_killmsg;
  80.     self._killmsg2=player_template_killmsg2;
  81.     setmodel(self,"progs/template.mdl");
  82.     self.modelindex_morph=self.modelindex;
  83.     self.weaponmodel="";
  84.     self.view_ofs = '0 0 22';
  85.     if(!deathmatch) setsize (self, VEC_HULL_MIN, VEC_HULL_MAX);
  86.     else     setsize (self, '-16 -16 -24', '16 16 40');
  87.     self.health = self.health * 0.75 / self.health_modifier;
  88.     self.health_modifier = 0.75;
  89.     makevectors(self.v_angle);
  90.     spawn_tfog(self.origin + 20 * v_forward);
  91.     DropBackpack2();
  92. //** PATCH_BEGIN - morph2 - Turrican ****
  93. // Make morphs ignore player colors.
  94.     if (self.colormap != 0)
  95.     {
  96.         self.temp_colormap = self.colormap;
  97.         self.colormap = 0;
  98.     }
  99. // Make morphs ignore player skins.
  100.     if (self.skin != 0)
  101.     {
  102.         self.temp_skin = self.skin;
  103.         self.skin = 0;
  104.     }
  105.     self.currentammo=0;
  106.     self.weapon=IT_AXE;
  107. //** PATCH_END - morph2 - Turrican ******
  108. };
  109.